<% var title = '播发系统管理后台' %>
<!DOCTYPE html>
<html>
  <head>
    <title><%= title %></title>
    <link rel="stylesheet" type="text/css" href="/css/bootstrap.css">
    <link rel="stylesheet" type="text/css" href="/css/font-awesome.css">
    <link rel="stylesheet" type="text/css" href="/css/style.css">
  </head>
  <body>
    <div class="container index-top">
        <div class="col-xs-12 col-sm-8 col-md-6 col-lg-4 col-center">
            <h1 class="text-center"><%= title %></h1>

            <br/>

            <form action="/register" method="post" class="form-horizontal" id="form-login">
                <div class="form-group">
                    <strong>登陆</strong>
                </div>
                <div class="form-group">
                    <div class="input-group">
                        <div class="input-group-addon"><i class="fa fa-envelope-o"></i></div>
                        <input type="email" class="form-control" id="login-inputEmail" name="email" placeholder="邮箱">
                    </div>
                </div>
                <div class="form-group">
                    <div class="input-group">
                        <div class="input-group-addon"><i class="fa fa-key"></i></div>
                        <input type="password" class="form-control" id="login-inputPassword" name="password" placeholder="密码">
                    </div>
                </div>
                <input type="text" class="hide" id="login-referrer" name="referrer">

                <div class="form-group">
                    <button type="submit" name="login-button" class="btn btn-block btn-lg btn-success"> 注 册 </button>
                </div>

                <div class="form-group">
                    <p class="hint"></p>
                </div>
            </form>

            <hr/>
            
            <div>
            已有账号？
                <a class="btn btn-primary" href="/login">立即登录 <span class="glyphicon glyphicon-menu-right"></span></a>
            </div>

            <hr/>
            
        </div>
    </div>


</body>
</html>

<script>
(function(){
    var $formLogin = $('#form-login');
    var $p = $formLogin.find('.hint');
    var $inputEmail = $('#login-inputEmail'),
        $inputPassword = $('#login-inputPassword');
    var _inputReferrer = $('#login-referrer');
    _inputReferrer.val(document.referrer || '');

    $formLogin.submit(function(event){
        var email = $.trim( $inputEmail.val() );
        var password = $.trim( $inputPassword.val() );

        if (!email) {
            $p.html('请输入您的电子邮箱。');
            $inputEmail.focus();
            return false;
        }

        if (!password) {
            $p.html('请输入您的密码。');
            $inputPassword.focus();
            return false;
        }

        $formLogin.find('button[name="login-button"]').attr('disabled', '');
    });
})();
</script>